package com.zk.bytecode.trace;

public class TraceMain {


    public static final void sendToSave(StackTraceManagement holder) {
        InMemorySaver.save(holder);
    }

    public static StackTraceManagement enter() {
        StackTraceManagement holder = StackTraceManagement.get();
        holder.increase();
        return holder;
    }

    public static void exit(StackTraceManagement holder) {
        if (!holder.isTraced()) {
            holder.trace();
        }
        if (holder.decrease() == 0) {
            sendToSave(holder);
        }
    }
}
